package top.conangao.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * @author ConanGao
 * @description
 * @since 2023/12/16 14:50
 **/
@EqualsAndHashCode(callSuper = true)
@Data
public abstract class BaseException extends RuntimeException{
    @Serial
    private static final long serialVersionUID = 4102669900127613541L;

    private int code;

    private String msg;

    public BaseException(int code) {
        this.code = code;
        this.msg = "";
    }

    public BaseException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseException(String msg) {
        super(msg);
        this.code = 500;
        this.msg = msg;
    }
}
